package com.mew.chess.core.game.pokdeng.game.common;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author dylin
 * @create 2021/5/6
 */
public enum PokDengCardType {

    None(0),  // "没有"),
    SanKung(1),   // "三公"),
    Straight(2),  // "顺子"),
    StraightFlush(3),//同花顺
    ThreeOfAKind(4),//"三条"
    Major(5);  // "天牌");

    private final int code;

    PokDengCardType(final int code) {
        this.code = code;
    }

    private final static Map<Integer, PokDengLinkType> stateMap
            = Arrays.stream(PokDengLinkType.values()).collect(Collectors.toMap(PokDengLinkType::code, code -> code));

    public int code() {
        return this.code;
    }


    public static PokDengLinkType parse(int code) {
        return stateMap.getOrDefault(code, PokDengLinkType.Prepare);
    }
}
